From 660a249ffc9d14861d4cffed91fe140483715815 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 1 Sep 2006 17:15:41 +0000 Subject: [PATCH] Bounds check lat/lon in waypt.c to try to help catch bogus data that makes it through the various readers. --- gpsbabel/waypt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gpsbabel/waypt.c b/gpsbabel/waypt.c index 0d2cd1c3a..57985ed22 100644 --- a/gpsbabel/waypt.c +++ b/gpsbabel/waypt.c @@ -87,6 +87,11 @@ waypt_add(waypoint *wpt) ENQUEUE_TAIL(&waypt_head, &wpt->Q); waypt_ct++; + if ((wpt->latitude < -90) || (wpt->latitude > 90.0)) + fatal ("Invalid latitude %f in waypoint.\n", wpt->latitude); + if ((wpt->longitude < -180) || (wpt->longitude > 180.0)) + fatal ("Invalid longitude %f in waypoint.\n", wpt->latitude); + /* * Some input may not have one or more of these types so we * try to be sure that we have these fields even if just by -- 2.30.2